home *** CD-ROM | disk | FTP | other *** search
/ Creative Computers / Creative Computers CD-ROM, Volume 1 (Legendary Design Technologies, Inc.)(1994).iso / shareware / fractals / mandanim / arptodf0.c < prev    next >
C/C++ Source or Header  |  1994-11-17  |  1KB  |  47 lines

  1. #include <exec/types.h>
  2. #include <exec/memory.h>
  3. #include <proto/exec.h>
  4. #include <proto/dos.h>
  5.  
  6. #define ARP "arp.library"
  7. #define OUT "LIBS:arp.library"
  8.  
  9. void main(void);
  10.  
  11. /**************************************************************************/
  12. /***    compile:    lc -v -cusf ARPtoDF0.c  (Lattice 5.04)              ***/
  13. /***                                                                    ***/
  14. /***    link with:  FROM LIB:c.o,ARPtoDF0.o                             ***/
  15. /***                TO ARPtoDF0                                         ***/
  16. /***                LIB LIB:lc.lib,LIB:amiga.lib                        ***/
  17. /***                DEFINE __main = __tinymain                          ***/
  18. /**************************************************************************/
  19.  
  20. void main()
  21. {
  22. BPTR inhandle,outhandle;
  23. BYTE *buf,h = 0;
  24. LONG size;
  25.  
  26.     if (inhandle = Open(ARP,1005))
  27.     {   Seek(inhandle,0,1);
  28.         size = Seek(inhandle,0,-1);
  29.         if (buf = (BYTE *)AllocMem(size,MEMF_PUBLIC))
  30.         {   if(Read(inhandle,buf,size) == size)
  31.             {   if(outhandle = Open(OUT,1006))
  32.                 {   if(Write(outhandle,buf,size) != size)
  33.                     {   h = 1;
  34.                     }
  35.                     Close(outhandle);
  36.                     if(h)
  37.                     {    DeleteFile(OUT);
  38.                     }
  39.                 }
  40.             }
  41.             FreeMem(buf,size);
  42.         }
  43.         Close(inhandle);
  44.     }
  45. }
  46.  
  47.